generated at
commandの解釈 | scrapVim
接続辞書に似たシステムを使ってみよう


まずはminimumに、ここだけ作ってみる
状態を持つ必要があるから、classで表現したほうが良いなあ
状態
count
繰り返しの数を指定している
[1-9] で開始
続いて [0-9] が入力された場合は、状態を変えない
operator でも motion でもないものが入力されたら状態を cancel にする
motion
commandを確定する
operator
ia が入力されたら text object へ移行
ia でも motion でもないものが入力されたらcalcelする
外部から文字を一つづつ入力していく
それぞれの状態に該当するcommandを予め定義しておく
js
const operators = { 'd': 'delete', 'c': 'change', 'y': 'yank', }
keymapのcustomizeはこの段階ではまだ考えない
最終的に出来上がるcommand例
json
{ "operator": { "repeat": 4, "type": "delete", "motion": { "repeat": 2, "type": "h", } }
無視するもの
iIaA などの count

commandParser.js
class CommandState


#2020-11-22 16:41:26